home *** CD-ROM | disk | FTP | other *** search
/ IRIX Base Documentation 2001 May / SGI IRIX Base Documentation 2001 May.iso / usr / share / catman / p_man / cat3 / ifl / iflTile3D.z / iflTile3D
Encoding:
Text File  |  1998-10-20  |  15.1 KB  |  397 lines

  1.  
  2.  
  3.  
  4. iiiiffffllllTTTTiiiilllleeee((((3333))))        IIIImmmmaaaaggggeeee FFFFoooorrrrmmmmaaaatttt LLLLiiiibbbbrrrraaaarrrryyyy CCCC++++++++ RRRReeeeffffeeeerrrreeeennnncccceeee MMMMaaaannnnuuuuaaaallll         iiiiffffllllTTTTiiiilllleeee((((3333))))
  5.  
  6.  
  7.  
  8. NNNNAAAAMMMMEEEE
  9.      iiiiffffllllTTTTiiiilllleeee3333DDDD - defines a simple 3-D rectangle
  10.  
  11. IIIINNNNHHHHEEEERRRRIIIITTTTSSSS FFFFRRRROOOOMMMM
  12.      This is a base class and therefore has no inheritance.
  13.  
  14. HHHHEEEEAAAADDDDEEEERRRR FFFFIIIILLLLEEEE
  15.      #include <ifl/iflTile.h>
  16.  
  17. DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
  18.      This class is used to describe rectangles (tiles). It is mostly used to
  19.      group together the six values describing the origin (_x,_y,_z) and size
  20.      (_n_x,_n_y,_n_z) of a rectangle in a convenient way.
  21.  
  22.      This is a template class that can be used with any scalar data type; e.g,
  23.      to construct a 3D integer tile use iflTile3D<int>, and iiiiffffllllTTTTiiiilllleeee3333DDDD<<<<ffffllllooooaaaatttt>>>>()
  24.      for a 3D-float tile.
  25.  
  26.      The following is an example on how to use a 3D integer tile.  iflTile
  27.      object can be declared in the following way:
  28.  
  29.               // unitialized
  30.               iflTile3D<int> tile;
  31.  
  32.               // initialized
  33.               iflTile3D<int> tile(xStart, yStart, zStart,
  34.                                   xSize, ySize, zSize);
  35.               iflTile3D<int> tile(tileA, tileB);
  36.  
  37.  
  38.      A useful function, ccccoooonnnnttttaaaaiiiinnnnssss(), is provided that can be used to determine
  39.      if this tile fully contains another.  An overloaded version allows
  40.      maximum (_x,_y,_z) bounds to be specified that are use to clip the other
  41.      tile; this version is used where a page might extend beyond the edge of
  42.      an image. Also two operators == and != are provided to find out whether
  43.      or not two tiles are the same.
  44.  
  45. CCCCLLLLAAAASSSSSSSS MMMMEEEEMMMMBBBBEEEERRRR FFFFUUUUNNNNCCCCTTTTIIIIOOOONNNN SSSSUUUUMMMMMMMMAAAARRRRYYYY
  46.      CCCCoooonnnnssssttttrrrruuuuccccttttoooorrrrssss
  47.  
  48.           iflTile3D<type>()
  49.  
  50.           iflTile3D<type>(type X, type Y, type Z, type nX, type nY, type nZ)
  51.  
  52.           iflTile3D<type>(const iflTile3D& that)
  53.           iflTile3D<type>(const iflTile2D<type>& that, type z=0, type nz=1)
  54.  
  55.           iflTile3D<type>(const iflTile3D<type>& a, const iflTile3D<type>& b)
  56.           iflTile3D<type>(const iflTile3D<type>& a, const iflTile3D<type>& b,
  57.                           const iflTile3D<type>& c)
  58.  
  59.  
  60.  
  61.  
  62.  
  63.                                                                         PPPPaaaaggggeeee 1111
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70. iiiiffffllllTTTTiiiilllleeee((((3333))))        IIIImmmmaaaaggggeeee FFFFoooorrrrmmmmaaaatttt LLLLiiiibbbbrrrraaaarrrryyyy CCCC++++++++ RRRReeeeffffeeeerrrreeeennnncccceeee MMMMaaaannnnuuuuaaaallll         iiiiffffllllTTTTiiiilllleeee((((3333))))
  71.  
  72.  
  73.  
  74.      IIIInnnniiiittttiiiiaaaalllliiiizzzzaaaattttiiiioooonnnn
  75.  
  76.           iflTile3D<type>& init(type X, type Y, type Z,
  77.                                 type Nx, type Ny, type Nz)
  78.           iflTile3D<type>& init(const iflTile3D<type>& tile)
  79.           iflTile3D<type>& init(const iflTile2D<type>& tile, type Z=0,
  80.                                 type Nz=1)
  81.  
  82.  
  83.      IIIInnnntttteeeerrrrsssseeeeccccttttiiiioooonnnn
  84.  
  85.           iflTile3D<type>& intersect(const iflTile3D<type>& a,
  86.                                      const iflTile3D<type>& b)
  87.           iflTile3D<type>& intersect(const iflTile3D<type>& a,
  88.                                      const iflTile3D<type>& b,
  89.                                      const iflTile3D<type>& c)
  90.  
  91.  
  92.      BBBBoooouuuunnnnddddiiiinnnngggg bbbbooooxxxx
  93.  
  94.           iflTile3D<type>& boundingBox(const iflTile3D<type>& a,
  95.                                        const iflTile3D<type>& b)
  96.           iflTile3D<type>& boundingBox(const iflTile3D<type>& a,
  97.                                        const iflTile3D<type>& b,
  98.                                        const iflTile3D<type>& c)
  99.  
  100.  
  101.      CCCChhhheeeecccckkkkiiiinnnngggg ffffoooorrrr ccccoooonnnnttttaaaaiiiinnnnmmmmeeeennnntttt
  102.  
  103.           int contains(type X, type Y, type Z) const
  104.           int contains(const iflTile3D<type>& tile) const
  105.           int contains(const iflTile3D<type>& tile,
  106.                        type xMax, type yMax, type zMax) const
  107.  
  108.  
  109.      EEEEqqqquuuuaaaalllliiiittttyyyy ooooppppeeeerrrraaaattttoooorrrrssss
  110.  
  111.           int operator==(const iflTile3D<type>& tile) const
  112.           int operator!=(const iflTile3D<type>& tile) const
  113.  
  114.  
  115.      GGGGrrrroooowwww////sssshhhhrrrriiiinnnnkkkk aaaannnndddd ooooffffffffsssseeeetttt ooooppppeeeerrrraaaattttiiiioooonnnnssss
  116.  
  117.           void operator+=(const iflXY<tileType>& offset)
  118.           void operator+=(const iflXYZ<tileType>& offset)
  119.           void operator-=(const iflXY<tileType>& offset)
  120.           void operator-=(const iflXYZ<tileType>& offset)
  121.           void grow(const iflXY<tileType>& delta)
  122.           void grow(const iflXYZ<tileType>& delta)
  123.           void shrink(const iflXY<tileType>& delta)
  124.           void shrink(const iflXYZ<tileType>& delta)
  125.  
  126.  
  127.  
  128.  
  129.                                                                         PPPPaaaaggggeeee 2222
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136. iiiiffffllllTTTTiiiilllleeee((((3333))))        IIIImmmmaaaaggggeeee FFFFoooorrrrmmmmaaaatttt LLLLiiiibbbbrrrraaaarrrryyyy CCCC++++++++ RRRReeeeffffeeeerrrreeeennnncccceeee MMMMaaaannnnuuuuaaaallll         iiiiffffllllTTTTiiiilllleeee((((3333))))
  137.  
  138.  
  139.  
  140.      AAAAssssssssiiiiggggnnnnmmmmeeeennnntttt ooooppppeeeerrrraaaattttoooorrrrssss
  141.  
  142.           iflTile3D<type>& operator=(const iflTile2D<type>& tile)
  143.           iflTile3D<type>& operator=(const iflTile3D<type>& tile)
  144.  
  145.  
  146. FFFFUUUUNNNNCCCCTTTTIIIIOOOONNNN DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNNSSSS
  147.      iiiiffffllllTTTTiiiilllleeee3333DDDD(((())))
  148.  
  149.           iflTile3D<type>()
  150.           iflTile3D<type>(type X, type Y, type Z, type nX, type nY, type nZ)
  151.           iflTile3D<type>(const iflTile3D& that)
  152.           iflTile3D<type>(const iflTile2D<type>& that, type Z=0, type nZ=1)
  153.           iflTile3D<type>(const iflTile3D<type>& a, const iflTile3D<type>& b)
  154.           iflTile3D<type>(const iflTile3D<type>& a, const iflTile3D<type>& b,
  155.                           const iflTile3D<type>& c)
  156.  
  157.  
  158.           The first version with no arguments constructs an uninitialized
  159.           iflTile3D.  The second version constructs an iflTile3D with the
  160.           origin set to (_X,_Y,_Z) and the size set to (_n_X,_n_Y,_n_Z).  The third
  161.           version constructs a copy of another 3D tile.  The fourth version
  162.           constructs a copy of another 3D tile and fills in the z attributes _Z
  163.           and _n_Z.  The fifth version constructs an iflTile3D whose origin and
  164.           size are set to the intersection of the tiles specified by _a and _b.
  165.           The final version constructs an iflTile3D whose origin and size are
  166.           set to the intersection of the tiles specified by _a, _b and _c.
  167.  
  168.      bbbboooouuuunnnnddddiiiinnnnggggBBBBooooxxxx(((())))
  169.  
  170.           iflTile3D<type>& boundingBox(const iflTile3D<type>& a,
  171.                                        const iflTile3D<type>& b)
  172.           iflTile3D<type>& boundingBox(const iflTile3D<type>& a,
  173.                                        const iflTile3D<type>& b,
  174.                                        const iflTile3D<type>& c)
  175.  
  176.  
  177.           The first version sets this object's origin and size to the
  178.           intersection of the tiles specified by _a and _b.  The second version
  179.           sets this object's origin and size to the intersection of the tiles
  180.           specified by _a, _b and _c.  The returned value is a reference to this
  181.           object.
  182.  
  183.      ccccoooonnnnttttaaaaiiiinnnnssss(((())))
  184.  
  185.           int contains(type X, type Y, type Z) const
  186.           int contains(const iflTile3D<type>& tile) const
  187.           int contains(const iflTile3D<type>& tile,
  188.                        type xMax, type yMax, type zMax) const
  189.  
  190.  
  191.  
  192.  
  193.  
  194.  
  195.                                                                         PPPPaaaaggggeeee 3333
  196.  
  197.  
  198.  
  199.  
  200.  
  201.  
  202. iiiiffffllllTTTTiiiilllleeee((((3333))))        IIIImmmmaaaaggggeeee FFFFoooorrrrmmmmaaaatttt LLLLiiiibbbbrrrraaaarrrryyyy CCCC++++++++ RRRReeeeffffeeeerrrreeeennnncccceeee MMMMaaaannnnuuuuaaaallll         iiiiffffllllTTTTiiiilllleeee((((3333))))
  203.  
  204.  
  205.  
  206.           This function returns true if this object contains the point
  207.           specified by (_X,_Y,_Z).  The second version returns true if this
  208.           object completely contains the iflTile3D specified by _t_i_l_e.  The
  209.           third version allows _t_i_l_e to be first clipped by the maximum bounds
  210.           specified by _x_M_a_x, _y_M_a_x and _z_M_a_x before checking for containment.
  211.  
  212.      iiiinnnniiiitttt(((())))
  213.  
  214.           iflTile3D<type>& init(type X, type Y, type Z,
  215.                                 type nX, type nY, type nZ)
  216.           iflTile3D<type>& init(const iflTile3D<type>& tile)
  217.           iflTile3D<type>& init(const iflTile2D<type>& tile,
  218.                                 type Z=0, type nZ=1)
  219.  
  220.  
  221.           The first version initializes this object with the origin set to
  222.           (_X,_Y,_Z) and the size set to (_n_X,_n_Y,_n_Z).  The second version
  223.           initializes this object with a copy of the 3D tile specified by
  224.           _t_i_l_e.  The third version initializes this object with a copy of
  225.           another 3D tile and fills in the z attributes _Z and _n_Z.
  226.  
  227.      ggggrrrroooowwww(((())))
  228.  
  229.           void grow(const iflXY<tileType>& delta)
  230.           void grow(const iflXYZ<tileType>& delta)
  231.  
  232.  
  233.           These methods grow the dimensions of this tile the amount indicated
  234.           by the _x, _y, and, for the second form, _z, members of _d_e_l_t_a.
  235.  
  236.      iiiinnnntttteeeerrrrsssseeeecccctttt(((())))
  237.  
  238.           iflTile3D<type>& intersect(const iflTile3D<type>& a,
  239.                                      const iflTile3D<type>& b)
  240.           iflTile3D<type>& intersect(const iflTile3D<type>& a,
  241.                                      const iflTile3D<type>& b,
  242.                                      const iflTile3D<type>& c)
  243.  
  244.  
  245.           The first version initializes this object with the origin and size
  246.           set to the intersection of the tiles specified by _a and _b.  The
  247.           second version initializes this object with the origin and size set
  248.           to the intersection of the tiles specified by _a, _b and _c.
  249.  
  250.      ooooppppeeeerrrraaaattttoooorrrr====(((())))
  251.  
  252.           iflTile3D<type>& operator=(const iflTile2D<type>& tile)
  253.           iflTile3D<type>& operator=(const iflTile3D<type>& tile)
  254.  
  255.  
  256.  
  257.  
  258.  
  259.  
  260.  
  261.                                                                         PPPPaaaaggggeeee 4444
  262.  
  263.  
  264.  
  265.  
  266.  
  267.  
  268. iiiiffffllllTTTTiiiilllleeee((((3333))))        IIIImmmmaaaaggggeeee FFFFoooorrrrmmmmaaaatttt LLLLiiiibbbbrrrraaaarrrryyyy CCCC++++++++ RRRReeeeffffeeeerrrreeeennnncccceeee MMMMaaaannnnuuuuaaaallll         iiiiffffllllTTTTiiiilllleeee((((3333))))
  269.  
  270.  
  271.  
  272.           The first assingment operator copies the values from the 2D tile
  273.           specified by _t_i_l_e and defaults z and nz to 0 and 1, respectively.
  274.           The second version simply does the normal memberwise assignment
  275.           operation.
  276.  
  277.      ooooppppeeeerrrraaaattttoooorrrr========(((())))
  278.  
  279.           int operator==(const iflTile3D<type>& tile) const
  280.  
  281.  
  282.           Returns TRUE if _t_i_l_e is the same as 'this' tile, FALSE otherwise.
  283.  
  284.      ooooppppeeeerrrraaaattttoooorrrr!!!!====(((())))
  285.  
  286.           int operator!=(const iflTile3D<type>& tile) const
  287.  
  288.  
  289.           Returns TRUE if _t_i_l_e is not the same as 'this' tile, FALSE
  290.           otherwise.
  291.  
  292.      ooooppppeeeerrrraaaattttoooorrrr++++====(((())))
  293.  
  294.           void operator+=(const iflXY<tileType>& offset)
  295.           void operator+=(const iflXYZ<tileType>& offset)
  296.  
  297.  
  298.           These methods add an offset to the origin of this tile.  The amount
  299.           to be added is indicated by the _x, _y, and, for the second form, _z,
  300.           members of _o_f_f_s_e_t.
  301.  
  302.      ooooppppeeeerrrraaaattttoooorrrr----====(((())))
  303.  
  304.           void operator-=(const iflXY<tileType>& offset)
  305.           void operator-=(const iflXYZ<tileType>& offset)
  306.  
  307.  
  308.           These methods subtract an offset from the origin of this tile.  The
  309.           amount to be subtracted is indicated by the _x, _y, and, for the
  310.           second form, _z, members of _o_f_f_s_e_t.
  311.  
  312.      sssshhhhrrrriiiinnnnkkkk(((())))
  313.  
  314.           void shrink(const iflXY<tileType>& delta)
  315.           void shrink(const iflXYZ<tileType>& delta)
  316.  
  317.  
  318.           These methods shrink the dimensions of this tile the amount
  319.           indicated by the _x, _y, and, for the second form, _z, members of
  320.           _d_e_l_t_a.
  321.  
  322.  
  323.  
  324.  
  325.  
  326.  
  327.                                                                         PPPPaaaaggggeeee 5555
  328.  
  329.  
  330.  
  331.  
  332.  
  333.  
  334. iiiiffffllllTTTTiiiilllleeee((((3333))))        IIIImmmmaaaaggggeeee FFFFoooorrrrmmmmaaaatttt LLLLiiiibbbbrrrraaaarrrryyyy CCCC++++++++ RRRReeeeffffeeeerrrreeeennnncccceeee MMMMaaaannnnuuuuaaaallll         iiiiffffllllTTTTiiiilllleeee((((3333))))
  335.  
  336.  
  337.  
  338. SSSSEEEEEEEE AAAALLLLSSSSOOOO
  339.      iflTile2D
  340.  
  341.  
  342.  
  343.  
  344.  
  345.  
  346.  
  347.  
  348.  
  349.  
  350.  
  351.  
  352.  
  353.  
  354.  
  355.  
  356.  
  357.  
  358.  
  359.  
  360.  
  361.  
  362.  
  363.  
  364.  
  365.  
  366.  
  367.  
  368.  
  369.  
  370.  
  371.  
  372.  
  373.  
  374.  
  375.  
  376.  
  377.  
  378.  
  379.  
  380.  
  381.  
  382.  
  383.  
  384.  
  385.  
  386.  
  387.  
  388.  
  389.  
  390.  
  391.  
  392.  
  393.                                                                         PPPPaaaaggggeeee 6666
  394.  
  395.  
  396.  
  397.